from django.db import models

# Create your models here.
class Cate(models.Model):
    name = models.CharField(max_length=10)
    desc = models.CharField(max_length=10)
    def __str__(self):
        return self.name
    class Meta:
        db_table = 'cate'



class News(models.Model):
    title = models.CharField(max_length=20)
    content = models.CharField(max_length=100)
    cate = models.ForeignKey(Cate,on_delete=models.CASCADE)
    addtime = models.DateTimeField(auto_now_add=True)
    read = models.IntegerField(default=0)
    write = models.IntegerField(default=0)
    def __str__(self):
        return self.title
    class Meta:
        db_table = 'news'